﻿using System;
using System.Collections.Generic;

namespace WholeSlideImageLibrary
{
    public sealed class WholeSlideImageReaderBuilder : IWholeSlideImageReaderBuilder
    {
        private readonly List<IImageIdentifier> _formats = new List<IImageIdentifier>();

        public IWholeSlideImageReaderBuilder AddFormat<T>(T identifier) where T : class, IImageIdentifier
        {
            if (identifier is null)
            {
                throw new ArgumentNullException(nameof(identifier));
            }

            _formats.Add(identifier);
            return this;
        }

        public WholeSlideImageReader Build()
        {
            return new WholeSlideImageReader(_formats);
        }
    }
}
